<!-- /* Description for file.
 * 招聘职位信息修改
 * @copyright     Copyright 2008-2010, PHInfo Services Inc. (http://www.phinfoservices.com)
 * @package       ues
 * @subpackage    ues/app/views/resources
 * @since         ues
 * @version       V0.0.1
 * @modifiedby   会兵2011年0705
 * @lastmodified  会兵2011年0705
 */
 -->

<?php
echo $html->css ( 'style' );
echo $html->css ( 'tab' );
//echo $javascript->link('jquery');
echo $html->css ( 'jquery-validate/css/screen' );
?>
<script type="text/javascript">

//验证是否必填
function test(id)
{
	var srt = "font#" + id;
	var isValidate =  $(srt).text();
	var validate = $.trim(isValidate);
	if(validate == "*"){
		return true;
	} else {
		return false;
	}
}

//添加验证
$(document).ready(function() {
	$.validator.setDefaults({       
		 submitHandler: function(form) {    
		  form.submit();    
		}       
	});    
			
// validate signup form on keyup and submit
$("#RecruitpositionEditForm").validate({
	rules: {
	"data[Recruitposition][name]": {
	required: test("name"),string:true,stringMinLength:0,stringMaxLength:50
	},
	"data[Recruitposition][description]": {
	required: test("description"),string:true,stringMinLength:0,stringMaxLength:255
	},
	"data[Recruitposition][memo]": {
	required: test("memo"),stringMinLength:0,stringMaxLength:255
	},
	"data[Recruitposition][salary]": {
	required: test("salary"),stringMinLength:0,stringMaxLength:255
	},
	"data[Recruitposition][addressRequired]": {
	required: test("addressRequired")
	},
	"data[Recruitposition][otherRequired]": {
	required: test("otherRequired"),stringMinLength:0,stringMaxLength:255
	},
	"data[Recruitposition][promotion1]": {
	required: test("promotion"),selectNone:true
	},
	"data[Recruitposition][manage]": {
	required: false,string:true,stringMinLength:0,stringMaxLength:50
	},
	"data[Recruitposition][minAgeRequired]" : {
	required: false,score:true
	},
	"data[Recruitposition][maxAgeRequired]" : {
	required: false,score:true
	},
	"data[Recruitposition][minWorkingLifeRequired]" : {
	required: false,score:true
	},
	"data[Recruitposition][maxWorkingLifeRequired]" : {
	required: false,score:true
	},
	"data[Recruitposition][languageSkillsRequired]": {
	required: false,stringMinLength:0,stringMaxLength:255
	},
	"data[Recruitposition][industryRequired]": {
	required: false,stringMinLength:0,stringMaxLength:50
	} 
	},
	messages: {
	}, 
focusInvalid:false,
onkeyup:false,
errorPlacement:function(error, element){
	error.appendTo(element.parent());
}
});
});
//验证结束


//职能二级菜单
$(document).ready(function(){
	$("#RecruitpositionPromotion1").change(function(){
		var CompetencyDroptoplist = $(this).val();
		if(CompetencyDroptoplist!="")
		{
			$.post("<?php echo ROOT_WEB_PATH; ?>/competencies/getcompetencies/",{
				Competency : $(this).val()
				},function(data,textStatus){
					 $("#RecruitpositionPromotion2:eq(0)>option").remove();
					 $(data).find("aaa").each(function(){
					//	 alert($(this).attr("name"));
					 $("#RecruitpositionPromotion2:eq(0)").append("<option></option>");
					 $("#RecruitpositionPromotion2:eq(0)>option:last").val($(this).attr("name")).html($(this).text());
				  });
				});
		}
	});
	$("#RecruitpositionEditForm").bind("submit", function() { 
		var value = "";
		if($("#RecruitpositionPromotion1 option:selected").text()!="不限")
		value = $("#RecruitpositionPromotion1 option:selected").text()+'_';
		if($("#RecruitpositionPromotion2 option:selected").text()!="不选"&&$("#RecruitpositionPromotion2 option:selected").text()!="--")
		value += $("#RecruitpositionPromotion2 option:selected").text()+'_';
		$("#RecruitpositionPromotion").val(value); });
});

//职能二级菜单
$(document).ready(function(){
	$("#RecruitpositionPromotion1").change(function(){
		var CompetencyDroptoplist = $(this).val();
		if(CompetencyDroptoplist!="")
		{
			$("#RecruitpositionPromotion").val($("#RecruitpositionPromotion1 option:selected").text() + "_");
			$.post("<?php echo ROOT_WEB_PATH; ?>/competencies/getcompetencies/",{
				Competency : $(this).val()
				},function(data,textStatus){
					 $("#RecruitpositionPromotion2:eq(0)>option").remove();
					 $(data).find("aaa").each(function(){
					 $("#RecruitpositionPromotion2:eq(0)").append("<option></option>");
					 $("#RecruitpositionPromotion2:eq(0)>option:last").val($(this).attr("name")).html($(this).text());
					 $("#RecruitpositionPromotion3:eq(0)>option").remove();
					 $("#RecruitpositionPromotion3:eq(0)").append("<option></option>");
					 $("#RecruitpositionPromotion3:eq(0)>option:last").val("").html("不选");
				  });
				});
		}
		else
		{
			$("#RecruitpositionPromotion2:eq(0)>option").remove();
			$("#RecruitpositionPromotion2:eq(0)").append("<option></option>");
			$("#RecruitpositionPromotion2:eq(0)>option:last").val("").html("不选");
			$("#RecruitpositionPromotion3:eq(0)>option").remove();
			$("#RecruitpositionPromotion3:eq(0)").append("<option></option>");
			$("#RecruitpositionPromotion3:eq(0)>option:last").val("").html("不选");
			$("#RecruitpositionPromotion").val("");
		}
	});
});

//职能三层字段 级联菜单 //
$(document).ready(function(){
	$("#RecruitpositionPromotion2").change(function(){
		var list = $(this).val();
		if(list!="")
		{
			$("#RecruitpositionPromotion").val($("#RecruitpositionPromotion1 option:selected").text() + "_" + $("#RecruitpositionPromotion2 option:selected").text() + "_");
			$.post("<?php echo ROOT_WEB_PATH; ?>/competencies/getcompetencies/",{
				Competency : $(this).val()
				},function(data,textStatus){
					 $("#RecruitpositionPromotion3:eq(0)>option").remove();
					 $(data).find("aaa").each(function(){
					//	 alert($(this).attr("name"));
					 $("#RecruitpositionPromotion3:eq(0)").append("<option></option>");
					 $("#RecruitpositionPromotion3:eq(0)>option:last").val($(this).attr("name")).html($(this).text());					 
				  });
				});
		}
		else
		{
			$("#RecruitpositionPromotion3:eq(0)>option").remove();
			$("#RecruitpositionPromotion3:eq(0)").append("<option></option>");
			$("#RecruitpositionPromotion3:eq(0)>option:last").val("").html("不选");
			$("#RecruitpositionPromotion").val($("#RecruitpositionPromotion1 option:selected").text() + "_");
		}
	});
	$("#RecruitpositionPromotion3").change(function(){
		var list = $(this).val();
		if(list!="")
		{
			if($("#RecruitpositionPromotion1 option:selected").text()!="不选"&&$("#RecruitpositionPromotion1 option:selected").text()!="不限")
			$("#RecruitpositionPromotion").val($("#RecruitpositionPromotion1 option:selected").text() + "_" + $("#RecruitpositionPromotion2 option:selected").text() + "_" + $("#RecruitpositionPromotion3 option:selected").text());
			else
			$("#RecruitpositionPromotion").val("");
		}
		else
		{
			if($("#RecruitpositionPromotion1 option:selected").text()!="不选"&&$("#RecruitpositionPromotion1 option:selected").text()!="不限")
			$("#RecruitpositionPromotion").val($("#RecruitpositionPromotion1 option:selected").text() + "_" + $("#RecruitpositionPromotion2 option:selected").text() + "_");
			else
			$("#RecruitpositionPromotion").val("");
		}
	});
});

	$(function()
	{
		$("#close").click(function(){		
			window.close();							
		});
	});

	$(function()
			{
				$("#deletefile").click(function(){
//					file = $("#RecruitpositionSpecification");   
//					file.after(file.clone());   
//					file.remove();
					window_location_href('<?php echo ROOT_WEB_PATH; ?>/recruitpositions/deletefile/<?php echo $data['Recruitposition']['id'];?>');
				});
			});
	//省份城市
	$(function(){
		//省份级联菜单 //
			$("#RecruitpositionProvinceId").change(function(){
				var workareaf = "" ;
				$('#RecruitpositionProvinceBaseid').val($(this).val());
				var list =  $('#RecruitpositionProvinceBaseid option:selected').text();
				$("#recruitpositionsaddressRequired").val($("#RecruitpositionProvinceId option:selected").text() + '-');
				if(list!="")
				{
					$.post("<?php echo ROOT_WEB_PATH; ?>/cities/getProvince/",{
						provicnceid : list
						},
					function(data,textStatus){
							 $("#RecruitpositionCityId:eq(0)>option").remove();
							 $(data).find("aaa").each(function(){
							// alert($(this).attr("name"));
							 $("#RecruitpositionCityId:eq(0)").append("<option></option>");
							 $("#RecruitpositionCityId:eq(0)>option:last").val($(this).attr("name")).html($(this).text());

						  });
						if($("#RecruitpositionCityId option:selected").html() != null){		  
								 workareaf = $("#RecruitpositionProvinceId option:selected").text() + '-' +$("#RecruitpositionCityId option:selected").html();
						}
						else{
							workareaf = $("#RecruitpositionProvinceId option:selected").text() + '-';
						}
						$("#recruitpositionsaddressRequired").val(workareaf);
							  
					});
				}
			});
			$("#RecruitpositionCityId").change(function(){
				var citylist = $(this).val();
				if(citylist!="")
				{
					if($("#RecruitpositionProvinceId option:selected").text()!=""&&$("#RecruitpositionCityId option:selected").text()!="")
					$("#recruitpositionsaddressRequired").val($("#RecruitpositionProvinceId option:selected").text() + "-" + $("#RecruitpositionCityId option:selected").text());
					else
					$("#recruitpositionsaddressRequired").val("");
				}
				else
				{
					if($("#RecruitpositionProvinceId option:selected").text()!=""&&$("#RecruitpositionProvinceId option:selected").text()!="")
					$("#recruitpositionsaddressRequired").val($("#RecruitpositionProvinceId option:selected").text() + "-");
					else
					$("#recruitpositionsaddressRequired").val("");
				}
			});
	});
</script>
<style>
.input{
	float:left;
}
</style>
<!-- 当前位置-->
<div id="tabmenubar">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td class="tabmenubartitle1"><?php echo  __('YourPosition');//您现在的位置：?></td>
		<td class="tabmenubartitle2"><?php echo __('Customer Managements');//一级目录
										   echo '>';echo __('recruitpositions');//二级目录
										   echo '>';?>
									<?php echo $html->tag('span', __('recruitpositions Edit',true));//当前操作地用span加粗?> 						  
		</td>
	</tr>
</table>
</div>
<!-- 当前位置-->
<?php echo $form->create('Recruitposition',array('action'=>'edit','type'=> 'post','enctype'=>'multipart/form-data'));?>
<?php echo $form->hidden('table',array('id'=>'table','default'=>$table));?>	
<div class="tabflex">
<fieldset><legend><?php __('recruitpositions Edit');?></legend>
<table width="100%" cellspacing="0" cellpadding="0" border="0"
	style="text-align: left">
		<?php 
			echo $form->hidden('id',array('value'=>$data['Recruitposition']['id']));
		?>
		<?php 
			echo $form->hidden('fileid',array('value'=>$data['Recruitposition']['specification']));
		?>
		<tr>
			<td></td>
			<td><?php __('recruitpositionsname');//职位名称?>:
				<font color="red" id="name">
				<?php if($fields['name'] == 1 && $fields['name'] !=null){echo "*";}?>
			</font>	
			</td>
			<td colspan="4">
				<?php 
					echo $form->input('name',array('label'=>false,'class'=>'TextBoxE1','value'=>$data['Recruitposition']['name'],'id'=>'recruitpositionsname'));
				?>
			</td>
		</tr>
		<tr>	
			<td></td>
			<td><?php __('recruitpositionsspecification');//职能?>:
				<font color="red" id="promotion">
				<?php if($fields['promotion'] == 1 && $fields['promotion'] !=null){echo "*";}?>
			</font>	
			</td>
			<td colspan="4"><?php echo $form->input('promotion',array('label'=>false,'div'=>false,'value'=>$data['Recruitposition']['promotion']));?>&nbsp;
			<?php 
				$options = array();
				foreach($professions as $eachrecord)
				{
					$options[$eachrecord['Competency']['id']] = $eachrecord['Competency']['name'];
				}
				echo $form->input('promotion1',array('empty' =>'不限','class' => 'TextBoxE1','options'=>$options,'label'=>false,'div'=>false));	
			?>
			<?php echo $form->input('promotion2',array('options'=>array('0'=>'--'),'label'=>false,'div'=>false));?>
			<?php echo $form->input('promotion3',array('options'=>array('0'=>'--'),'label'=>false,'div'=>false));		
					?>
			</td>
		<!--经    理-->
		</tr>
		<tr>
			<td width="5%"></td>
			<td width="10%"><?php __('recruitpositions Manager');//经    理?>:</td>
			<td width="30%">
			<?php 	
				echo $form->input('manage',array('label'=>false,'value'=>$data['Recruitposition']['manage'],'class' => 'TextBoxE1'));
			?> 
			</td>
			<!--性别-->
			<td width="5%"></td></td>
			<td width="10%"><?php __('recruitpositions Sex');//性别要求?>:</td>
			<td width="30%">
			<?php echo $form->input('sexRequired',
					array(
					'options'=>array(''=>'未知','男'=>'男','女'=>'女'),
					'label'=>false,'div'=>false,'class'=>'TextBoxE1','default' =>$data['Recruitposition']['sexRequired']));		
			?>
			</td>
		</tr>
		<tr>
			<td ></td>
			<td><?php __('recruitpositions Age');//年龄要求?>:</td>
			<td>
				<?php 	
					echo $form->input('minAgeRequired',array('label'=>false,'class'=>'TextBoxS','value'=>$data['Recruitposition']['minAgeRequired']));
				?><span style="float:left">&nbsp;至&nbsp;</span> 
				<?php 	
					echo $form->input('maxAgeRequired',array('label'=>false,'class'=>'TextBoxS','value'=>$data['Recruitposition']['maxAgeRequired']));
				?> 
				
			</td>
		<!--工作年限-->
			<td></td>
			<td><?php __('resumesworkingLife');//工作年限?>:</td>
			<td>
				<?php 	
					echo $form->input('minWorkingLifeRequired',array('label'=>false,'class'=>'TextBoxS','value'=>$data['Recruitposition']['minWorkingLifeRequired']));
				?> <span style="float:left">&nbsp;至&nbsp;</span> 
				<?php 	
					echo $form->input('maxWorkingLifeRequired',array('label'=>false,'class'=>'TextBoxS','value'=>$data['Recruitposition']['maxWorkingLifeRequired']));
				?> 
			</td>
		</tr>
		<tr>
		<!--学历-->
			<td></td>
			<td><?php __('recruitpositions Degree');//学历要求?>:</td>
			<td >
				<?php 
					$options = array();
						foreach($advanceddegreeranks as $eachrecord)
						{
							$options[$eachrecord['Advanceddegreerank']['id']] = $eachrecord['Advanceddegreerank']['name'];
						}
						echo $form->input('advanceddegreerank_id',array('empty' =>'不限','options'=>$options,'label'=>false,'div'=>false,'class'=>'TextBoxE1','default'=>$data['Recruitposition']['advanceddegreerank_id']));
					?>
			</td>
			<!--外语要求-->
			<td></td>
			<td><?php __('recruitpositions lang');//外语要求?>:</td>
			<td>
				<?php 	
					echo $form->input('languageSkillsRequired',array('label'=>false,'value'=>$data['Recruitposition']['languageSkillsRequired'],'class'=>'TextBoxE1'));
				?> 
			</td>
		</tr>
		<tr>
		<!--行业要求-->
			<td></td>
			<td><?php __('recruitpositions Industry');//行业要求?>:</td>
			<td>
				<?php 	
					echo $form->input('industryRequired',array('label'=>false,'value'=>$data['Recruitposition']['industryRequired'],'class'=>'TextBoxE1'));
				?> 
			</td>
			<!--地    址-->
			<td></td>
			<td><?php __('Address');//地    址?>:
				<font color="red" id="addressRequired">
				<?php if($fields['addressRequired'] == 1 && $fields['addressRequired'] !=null){echo "*";}?>
			</font>	
			</td><!--
			<td>
				<?php 	
					//echo $form->input('addressRequired',array('label'=>false,'value'=>$data['Recruitposition']['addressRequired'],'class'=>'TextBoxE1'));
				?>
			--><td>
			<?php echo $form->input('addressRequired',array('label'=>false,'div'=>false,'readonly'=>true,'value'=>$data['Recruitposition']['addressRequired'],'id'=>'recruitpositionsaddressRequired'));?>
			<?php $options = array();
					foreach($provinces as $eachrecord)
					{
						$options[$eachrecord['Province']['id']] = $eachrecord['Province']['name'];
						$optionsbase[$eachrecord['Province']['id']] = $eachrecord['Province']['baseid'];
					}
					echo $form->input('province_id',array('options'=>$options,'label'=>false,'div'=>false,'empty'=>'请选择'));
					echo $form->input('province_baseid',array('options'=>$optionsbase,'label'=>false,'div'=>false,'style'=>"display:none;"));
				?>
			<?php $options = array();
					foreach($cities as $eachrecord)
					{
						$options[$eachrecord['City']['id']] = $eachrecord['City']['name'];
					}
					echo $form->input('city_id',array('options'=>$options,'label'=>false,'div'=>false,'empty'=>'请选择'));
			 ?>		 
			</td>
		</tr>
		<tr>
		<!--职位描述-->
		<td></td>
		<td><?php __('recruitpositionsdescription');//职位描述?>:
			<font color="red" id="description">
				<?php if($fields['description'] == 1 && $fields['description'] !=null){echo "*";}?>
			</font>	
		</td>
		<td colspan="4">
			<?php 	
				echo $form->textarea('description',array('type'=>'textarea','label'=>false,'value'=>$data['Recruitposition']['description'],'class'=>'areaStyle'));
			?> 
		</td>

		</tr>
		<tr>
		<!--职位要求-->
		<td></td>
		<td><?php __('recruitpositions positions');//职位要求?>:
			<font color="red" id="otherRequired">
				<?php if($fields['otherRequired'] == 1 && $fields['otherRequired'] !=null){echo "*";}?>
			</font>	
		</td>
		<td colspan="4">
			<?php 	
				echo $form->textarea('otherRequired',array('type'=>'textarea','label'=>false,'value'=>$data['Recruitposition']['otherRequired'],'class'=>'areaStyle'));
			?> 
		</td>
		</tr>
		<tr>
		<!--薪资福利-->
		<td></td>
		<td><?php __('recruitpositionssalary');//薪资福利?>:
			<font color="red" id="salary">
				<?php if($fields['salary'] == 1 && $fields['salary'] !=null){echo "*";}?>
			</font>	
		</td>
		<td colspan="4">
			<?php 	
				echo $form->textarea('salary',array('type'=>'textarea','label'=>false,'value'=>$data['Recruitposition']['salary'],'class'=>'areaStyle'));
			?> 
		</td>
		</tr>
		<tr>
		<!--职位备注-->
		<td></td>
		<td><?php __('recruitpositionsmemo');//职位备注?>:
			<font color="red" id="memo">
				<?php if($fields['memo'] == 1 && $fields['memo'] !=null){echo "*";}?>
			</font>	
		</td>
		<td colspan="4">
			<?php 	
				echo $form->textarea('memo',array('type'=>'textarea','label'=>false,'value'=>$data['Recruitposition']['memo'],'class'=>'areaStyle'));
			?> 
		</td>
		</tr>
		<tr>
		<!--职位说明书-->
		<td></td>
		<td><?php __('recruitpositions userfile');//职位说明书?>:</td>
		<td colspan="2">
			<?php 	
				echo $form->file('Specification',array('class'=>'TextBoxL','label'=>false,'name'=>'Specification','id'=>'recruitpositionsspecification'));
			?> 
		</td>
		<td><?php 
					if($file!=null)
					{	
						$dir="files-specification";
						echo $html->link($file['Attachment']['fileName'],
							'/recruitpositions/down/'.$dir.'/'.$file['Attachment']['filePath']);
					}
				?>
		</td>
		<td>		
			<?php 
			if($file!=null)
			{	
				echo $form->button('取消附件',array('class'=>'btn4','id'=>'deletefile'));
			}
			?>
		</td>
		</tr>
</table>
</fieldset>
</div>
<table width="30%" cellspacing="0" cellpadding="0" border="0" style="text-align: left">
	<tr>
		<td width="50"></td>
		<td width="100"><?php echo $form->button('确定',array('type'=>'submit','class'=>'btn2'));?>  <!-- __('reset', true)取消-->
		<td width="100"><?php echo $form->button('关闭',array('class'=>'btn2','id'=>'close'));?>  <!-- __('reset', true)取消-->
		</td>
	</tr>
</table>
<?php echo $form->end();?>
